package com.tsing.common.exceptions;

/**
 * 路由错误码定义接口
 */
public interface CommonException {

    final int PROXYERR = 900;

    enum Proxy implements ExceptionType {
        TOKEN_IS_REQUIRED(PROXYERR + 1, "必须携带token"),
        TOKEN_USER_NOT_EXIST(PROXYERR + 2, "用户不存在或token已经过期"),
        TOKEN_VERIFY_ERROR(PROXYERR + 3, "token验证用户失败"),
        SHIRO_UNAUTHORIZED_EXCEPTIONT(PROXYERR + 4, "shiro认证失败"),
        SHIRO_URI_EXCEPTIONT(PROXYERR + 5, "读取权限信息失败"),
        SHIRO_AUTHORIZATION_EXCEPTIONT(PROXYERR + 6, "您没有权限进行此操作"),
        REDIS_NOT_EXSIT(PROXYERR + 7, "从redis中读取数据失败"),
        GRIDFS_SAVE_ERROR(PROXYERR + 9, "文件保存失败"),
        GRIDFS_FILE_SIZE(PROXYERR + 10, "文件大小超出限制"),
        GRIDFS_QUERY_FILE_ERROR(PROXYERR + 11, "读取文件失败"),
        BASE64_PARAM_IS_REQUIRED(PROXYERR + 14, "base64加密错误"),
        BASE64_ENCODING_ERROR(PROXYERR + 15, "base64解密错误"),
        FILE_INPUTSTREAM2FILE_ERROR(PROXYERR + 16, "inputstream 2 file error"),
        BEAN_LIST_COPY_ERROR(PROXYERR + 18, "list bean copy error"),
        QUARTZ_INIT_ERROR(PROXYERR + 20, "quartz init error"),
        QUARTZ_CRON_ERROR(PROXYERR + 21, "quartz cron error"),
        QUARTZ_JOB_ADD_ERROR(PROXYERR + 22, "quartz add job error"),
        QUARTZ_JOB_UPDATE_ERROR(PROXYERR + 23, "quartz update job error"),
        QUARTZ_JOB_DELETE_ERROR(PROXYERR + 24, "quartz delete job error"),
        QUARTZ_JOB_CLOSE_ALL_ERROR(PROXYERR + 25, "quartz close all job error"),
        QUARTZ_JOB_EXE_ERROR(PROXYERR + 26, "定时任务执行出错"),
        HTTPCLIENT_FILE_ERROR(PROXYERR + 27, "httpclient file request error"),
        FILE_FORMAT_CHECK_ERREO(PROXYERR + 28, "文件格式错误"),
        SELECT_COUNT_NOT_IS_ONE(PROXYERR + 29, "查询结果不唯一"),
        OTHER(PROXYERR + 30, "unkonw exception");

        private int code;
        private String description;

        Proxy(int code, String description) {
            this.code = code;
            this.description = description;
        }

        @Override
        public int getCode() {
            return code;
        }

        @Override
        public String getDescription() {
            return description;
        }

    }

}
